<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>2-31组件切换另一种方式</title>
</head>
<body>
<div id="app">
  <a href="#" @click.prevent="comName='login'">login</a>
  <a href="#" @click.prevent="comName='register'">register</a>
  <component :is="comName"></component>
</div>
</body>
<script src="./js/vue.js"></script>
<script>
  Vue.component('login',{
    template:"<div>login page</div>"
  })
  Vue.component('register',{
    template: "<div>register page</div>"
  })
  new Vue({
    el:"#app",
    data:{
      comName:""
    }
  })
</script>
</html>